<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateGoldBeansTable extends Migration
{
    public function up()
    {
        Schema::create('gold_beans', function (Blueprint $table) {
            $table->id();
	        $table->unsignedBigInteger('user_id')->index()->default(0);
	        $table->decimal('origin', 10, 2)->nullable()->default(0);
	        $table->decimal('result', 10, 2)->nullable()->default(0);
	        $table->decimal('money', 10, 2)->nullable()->default(0);
	        $table->string('remark')->nullable()->index();
	        $table->string('reason')->nullable();
	        $table->text('data')->nullable();
            $table->timestamps();
	        $table->index(['created_at']);
        });
    }

    public function down()
    {
        Schema::dropIfExists('gold_beans');
    }
}
